{% extends 'common/basic_list.html' %}
{% block list_title %}
    用户
{% endblock %}

{% block list_filter %}
    <div class="col-sm-4">
        <div class="input-group">
            <a href="user_add/"
               class="btn btn-sm btn-success"><i class="fa fa-plus"></i> 新增</a>
            &nbsp;
            <a href="javascript:void(0)"
               onclick="deleteBatch()"
               class="btn btn-sm btn-danger"><i class="fa fa-trash"></i> 批量删除</a>
        </div>
    </div>
{% endblock %}

{% block list_content %}
    <table class="table table-striped table-bordered table-hover dataTables-example dataTable">
        <thead>
        <tr>
            <th style="width: 3%"><input id="checkall" type="checkbox" class="i-checks"></th>
            <th style="width: 10%;">
                <a class="order-by-column" data-column="username" href="#">
                    <i class="fa fa-sort order-by-column_icon"></i>用户
                </a>
            </th>
            <th style="width: 10%;">
                <a class="order-by-column" data-column="email" href="#">
                    <i class="fa fa-sort order-by-column_icon"></i>邮件
                </a>
            </th>
            <th style="width: 10%;">
                <a class="order-by-column" data-column="is_active" href="#">
                    <i class="fa fa-sort order-by-column_icon"></i>有效
                </a>
            </th>
            <th style="width:15%;">操作</th>
        </tr>
        </thead>
        <tbody>
        {% for o in result_list %}
            <tr>
                <td>
                    <input type="checkbox" class="i-checks icheck" id="{{ o.id }}" name="input[]">
                </td>
                <td>{{ o.username }}</td>
                <td>{{ o.email }}</td>
                <td>{{ o.is_active|bool_to_human }}</td>
                <td>
                    <a href="{{ o.id }}/user_edit/"
                       class="btn  btn-sm btn-info"><i class="fa fa-edit"></i>编辑</a>
                    <a href="javascript:void(0)"
                       onclick="deleteAction('{{ o.id }}')"
                       class="btn  btn-sm btn-danger"><i class="fa fa-trash"></i>删除</a>
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% endblock %}